/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

/* Text Image TextInput View ListView组件*/
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  Image,
  TextInput,
  View,
  ListView
} from 'react-native';

class AwesomeProject extends Component {
  constructor(props){
     super(props);
     var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
     this.state = {
        dataSource: ds.cloneWithRows(['John', 'Joel', 'James', 'Jimmy', 'Jackson', 'Jillian', 'Julie'])
     };
  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
        <Text style={styles.instructions}>
          Hello world !
        </Text>
        <Image style={styles.img} source={require('./img/test.png')} />
        <TextInput style={styles.inp} placeholder="Hello" />
        <ListView  dataSource={this.state.dataSource}  renderRow={(rowData) => <Text>{rowData}</Text>} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
  img: {
    width:100,
    height:100
  },
  inp:{
    width:200,
    height:30,
    marginLeft:10,
    borderWidth:2,
    borderColor:'#00ff00'
    
  }
});

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

